/*
 * @Description: 区间站场接口
 * @Author: Liu Zhiwang
 * @Date: 2021-03-03 14:59:12
 * @LastEditTime: 2021-09-28 17:53:45
 * @LastEditors: Liu Zhiwang
 */
import request from '@/utils/request'

// 线路（分页）
export function getListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/pageData') : '/jcwBasicgz/jcLineSite/pageData',
    method: 'GET',
    params: params
  })
}

// 添加/编辑
export function updateData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/saveOrUpdateData') : '/jcwBasicgz/jcLineSite/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}

// 删除
export function deleteData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/delete') : `/jcwBasicgz/jcLineSite/delete`,
    method: 'POST',
    data: params
  })
}

// 获取线路列表树结构
export function getSeclineTree(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcSecline/getSeclineTree') : `/jcwBasicgz/jcSecline/getSeclineTree`,
    method: 'GET',
    params: params
  })
}

// 获取区间站场字典接口
export function getSiteDictory(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcSite/pageData') : `/jcwBasicgz/jcSite/pageData`,
    method: 'GET',
    params: params
  })
}

// 获取行别接口
export function getDirection(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcDirection/pageData') : `/jcwBasicgz/jcDirection/pageData`,
    method: 'GET',
    params: params
  })
}

// 区站管辖列表查询
export function getJcDeptSite(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcDeptSite/listData') : `/jcwBasicgz/jcDeptSite/listData`,
    method: 'GET',
    params: params
  })
}

// 区站管辖保存
export function updatecDeptSite(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcDeptSite/saveOrUpdateData') : '/jcwBasicgz/jcDeptSite/saveOrUpdateData',
    method: 'POST',
    data: params.lineSiteOperateAttrList
  })
}

// 获取接触网工区
export function findWorkDeptList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/dept/findWorkDeptList') : `/jcwBasicgz/dept/findWorkDeptList`,
    method: 'GET',
    params: params
  })
}

// 获取新增编辑时，线路没有的区间站场
export function getSitesByLine(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/getSitesByLine') : `/jcwBasicgz/jcLineSite/getSitesByLine`,
    method: 'GET',
    params: params
  })
}
